package JLB_Chapter_11;

interface Constants {
    public static final int Constants_A = 1;
    public static final int Constants_B = 12;
}

public class code_11_01 {
    // 将常量放置在枚举类型中
    enum Constants2 {
        Constants_A, Constants_B
    }

    public static void doit(int c) {
        switch (c) {
            case Constants.Constants_A: {
                System.out.println("doit() Constants_A");
                break;
            }
            case Constants.Constants_B: {
                System.out.println("doit() Constants_B");
                break;
            }
        }
    }

    public static void doit2(Constants2 c) {
        switch(c) {
            case Constants_A: {
                System.out.println("doit2() Constants_A");
                break;
            }
            case Constants_B: {
                System.out.println("doit2() Constants_B");
                break;
            }
        }
    }

    public static void main(String[] args) {
        doit(Constants.Constants_A);
        doit2(Constants2.Constants_A);
        doit2(Constants2.Constants_B);
    }
}
